//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class CVectorD {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CVectorD(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVectorD obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CVectorD(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setX(double value) {
    nelmiscJNI.CVectorD_x_set(swigCPtr, this, value);
  }

  public double getX() {
    return nelmiscJNI.CVectorD_x_get(swigCPtr, this);
  }

  public void setY(double value) {
    nelmiscJNI.CVectorD_y_set(swigCPtr, this, value);
  }

  public double getY() {
    return nelmiscJNI.CVectorD_y_get(swigCPtr, this);
  }

  public void setZ(double value) {
    nelmiscJNI.CVectorD_z_set(swigCPtr, this, value);
  }

  public double getZ() {
    return nelmiscJNI.CVectorD_z_get(swigCPtr, this);
  }

  public static CVectorD getNull() {
    long cPtr = nelmiscJNI.CVectorD_Null_get();
    return (cPtr == 0) ? null : new CVectorD(cPtr, false);
  }

  public static CVectorD getI() {
    long cPtr = nelmiscJNI.CVectorD_I_get();
    return (cPtr == 0) ? null : new CVectorD(cPtr, false);
  }

  public static CVectorD getJ() {
    long cPtr = nelmiscJNI.CVectorD_J_get();
    return (cPtr == 0) ? null : new CVectorD(cPtr, false);
  }

  public static CVectorD getK() {
    long cPtr = nelmiscJNI.CVectorD_K_get();
    return (cPtr == 0) ? null : new CVectorD(cPtr, false);
  }

  public CVectorD() {
    this(nelmiscJNI.new_CVectorD__SWIG_0(), true);
  }

  public CVectorD(double _x, double _y, double _z) {
    this(nelmiscJNI.new_CVectorD__SWIG_1(_x, _y, _z), true);
  }

  public CVectorD(CVector v) {
    this(nelmiscJNI.new_CVectorD__SWIG_2(CVector.getCPtr(v), v), true);
  }

  public CVectorD(CVectorD v) {
    this(nelmiscJNI.new_CVectorD__SWIG_3(CVectorD.getCPtr(v), v), true);
  }

  public CVectorD addSelf(CVectorD v) {
    return new CVectorD(nelmiscJNI.CVectorD_addSelf(swigCPtr, this, CVectorD.getCPtr(v), v), false);
  }

  public CVectorD subSelf(CVectorD v) {
    return new CVectorD(nelmiscJNI.CVectorD_subSelf(swigCPtr, this, CVectorD.getCPtr(v), v), false);
  }

  public CVectorD mulSelf(double f) {
    return new CVectorD(nelmiscJNI.CVectorD_mulSelf(swigCPtr, this, f), false);
  }

  public CVectorD divSelf(double f) {
    return new CVectorD(nelmiscJNI.CVectorD_divSelf(swigCPtr, this, f), false);
  }

  public CVectorD add(CVectorD v) {
    return new CVectorD(nelmiscJNI.CVectorD_add(swigCPtr, this, CVectorD.getCPtr(v), v), true);
  }

  public CVectorD sub(CVectorD v) {
    return new CVectorD(nelmiscJNI.CVectorD_sub__SWIG_0(swigCPtr, this, CVectorD.getCPtr(v), v), true);
  }

  public CVectorD mul(double f) {
    return new CVectorD(nelmiscJNI.CVectorD_mul__SWIG_0(swigCPtr, this, f), true);
  }

  public CVectorD div(double f) {
    return new CVectorD(nelmiscJNI.CVectorD_div(swigCPtr, this, f), true);
  }

  public CVectorD sub() {
    return new CVectorD(nelmiscJNI.CVectorD_sub__SWIG_1(swigCPtr, this), true);
  }

  public double mul(CVectorD v) {
    return nelmiscJNI.CVectorD_mul__SWIG_1(swigCPtr, this, CVectorD.getCPtr(v), v);
  }

  public double norm() {
    return nelmiscJNI.CVectorD_norm(swigCPtr, this);
  }

  public double sqrnorm() {
    return nelmiscJNI.CVectorD_sqrnorm(swigCPtr, this);
  }

  public void normalize() {
    nelmiscJNI.CVectorD_normalize(swigCPtr, this);
  }

  public CVectorD normed() {
    return new CVectorD(nelmiscJNI.CVectorD_normed(swigCPtr, this), true);
  }

  public void set(double _x, double _y, double _z) {
    nelmiscJNI.CVectorD_set(swigCPtr, this, _x, _y, _z);
  }

  public boolean isEqual(CVectorD v) {
    return nelmiscJNI.CVectorD_isEqual(swigCPtr, this, CVectorD.getCPtr(v), v);
  }

  public boolean notEqual(CVectorD v) {
    return nelmiscJNI.CVectorD_notEqual(swigCPtr, this, CVectorD.getCPtr(v), v);
  }

  public boolean isNull() {
    return nelmiscJNI.CVectorD_isNull(swigCPtr, this);
  }

  public void sphericToCartesian(double r, double theta, double phi) {
    nelmiscJNI.CVectorD_sphericToCartesian(swigCPtr, this, r, theta, phi);
  }

  public void cartesianToSpheric(SWIGTYPE_p_double r, SWIGTYPE_p_double theta, SWIGTYPE_p_double phi) {
    nelmiscJNI.CVectorD_cartesianToSpheric(swigCPtr, this, SWIGTYPE_p_double.getCPtr(r), SWIGTYPE_p_double.getCPtr(theta), SWIGTYPE_p_double.getCPtr(phi));
  }

  public void serial(IStream f) {
    nelmiscJNI.CVectorD_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public CVectorD assign(CVector v) {
    return new CVectorD(nelmiscJNI.CVectorD_assign(swigCPtr, this, CVector.getCPtr(v), v), false);
  }

  public void copyTo(CVector dest) {
    nelmiscJNI.CVectorD_copyTo(swigCPtr, this, CVector.getCPtr(dest), dest);
  }

  public CVector asVector() {
    return new CVector(nelmiscJNI.CVectorD_asVector(swigCPtr, this), true);
  }

}
